//
//  TopLikeViewController.m
//  ZooNgonDoiOS
//
//  Created by Trung sound on 6/5/12.
//  Copyright (c) 2012 Personal. All rights reserved.
//

#import "TopLikeViewController.h"
#import "HomeViewController.h"
#import "TopNewController.h"
#import "CreateFoodViewController.h"
#import "CreateSpotViewController.h"
#import "IndividualViewController.h"
#import "TopNewController.h"

@implementation TopLikeViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 460)];
        [lbl setText:@"Top like Screen"];
        _tabBarController = [[UITabBarController alloc]init];
        

    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    HomeViewController *homeViewController= [[HomeViewController alloc]init];
    NSLog(@"%@",homeViewController.view.frame.size.height);
    CreateFoodViewController *createFoodViewController = [[CreateFoodViewController alloc]init];
    IndividualViewController *individualViewController = [[IndividualViewController alloc]init];
    TopNewController *commentViewController = [[TopNewController alloc]init];
    _tabBarController.wantsFullScreenLayout = YES;
    _tabBarController.viewControllers = [NSArray arrayWithObjects:homeViewController, createFoodViewController, individualViewController, commentViewController, nil];
    
    [self.view addSubview:_tabBarController.view];
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [self hideTabBar];
}

- (void) hideTabBar {
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.4];
    for(UIView *view in _tabBarController.view.subviews)
        {
        CGRect _rect = view.frame;
        if([view isKindOfClass:[UITabBar class]])
            {
            if (hiddenTabBar) {
                _rect.origin.y = 0;
                [view setFrame:_rect];
            } else {
                _rect.origin.y = 0;
                [view setFrame:_rect];
            }
            } else {
                if (hiddenTabBar) {
                    _rect.size.height = 431;
                    [view setFrame:_rect];
                } else {
                    _rect.size.height = 480;
                    [view setFrame:_rect];
                }
            }
        }    
    [UIView commitAnimations];
    
    hiddenTabBar = !hiddenTabBar;
}


- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
